package pl.edu.agh.jemo.evolution.objfunc.impl;

import javax.swing.JPanel;

import pl.edu.agh.jemo.evolution.genotype.Genotype;
import pl.edu.agh.jemo.evolution.objfunc.ClassicObjectiveFunction;
import pl.edu.agh.jemo.evolution.specimen.Specimen;

public class SimpleYetMoreComplicated2DObjectiveFunc extends
		ClassicObjectiveFunction {

	@Override
	public Double calculateValue(Specimen specimen) {
		Genotype[] genotype = specimen.getGenotype().clone();
		// Maximalization
		return -((Math.pow(Math.abs(genotype[0].asDouble()) - 1., 2) + Math.pow(Math.abs(genotype[1].asDouble())
				- 1., 2)));
	}

	@Override
	public JPanel getConfigPanel() {
		return null;
	}
	
	public SimpleYetMoreComplicated2DObjectiveFunc() {
		dimensions = 2;
		Double[][] tempBoundaries = { { -2. , 2. } , {-2. , 2. } };
		boundaries = tempBoundaries;
		formula = "-((abs(x)-" + 1. + ")**2+(abs(y)-" + 1. + ")**2)";
	}

	@Override
	public Double getMaxValue() {
		return null;
	}

	@Override
	public Double getMinValue() {
		return null;
	}


}
